package gae.google.tcserver.servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * The <tt>LogoutServlet</tt> class invalidates an existing session  
 *
 * @author Lars Friberg
 *
 * @date 2011-01-15
 */
public class LogoutServlet extends HttpServlet {

	/**
	 * Serial version Id
	 */
	private static final long serialVersionUID = 5136841227029544493L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		HttpSession session = request.getSession(false);
		if (session.getAttribute("userkeyid") != null){

			request.getSession().invalidate();
		}
		response.sendRedirect(request.getContextPath()+ "/TeamCalendar.html");
    }
}
